<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	template="/layout/template.xhtml">

	<ui:define name="body">

		<rich:panel rendered="#{identity.isLoggedIn()}">
			<f:facet name="header">userRoleList</f:facet>

			<div class="results">

				<h:outputText value="No user exists"
					rendered="#{empty userList.resultList}" />

				<h:dataTable id="userList" var="user" value="#{userList.resultList}"
					rendered="#{not empty userList.resultList}">
					<h:column>
						<f:facet name="header">#{messages.userName}</f:facet>
						<s:link id="user" value="#{user.username}" propagation="none"
							view="/Settings/User/viewUser.xhtml">
							<f:param name="username" value="#{user.username}" />
							<f:param name="path" value="userList"/>
						</s:link>
					</h:column>
					<h:column>
						<f:facet name="header">#{messages.email}</f:facet>
						<h:outputText value="#{user.email}" />
					</h:column>
					<h:column>
						<f:facet name="header">#{messages.name}</f:facet>
						<h:outputText value="#{user.name}" />
					</h:column>
					<h:column>
						<f:facet name="header">#{messages.surname}</f:facet>
						<h:outputText value="#{user.surname}" />
					</h:column>

					<h:column>
						<f:facet name="header">#{messages.userRoles}</f:facet>
						<h:outputText value="#{user.userRolesString()}" />
					</h:column>
				</h:dataTable>

			</div>

		</rich:panel>

		<div class="actionButtons">
			<s:button id="createUser" value="#{messages.CreateUser}"
				view="/Settings/User/createUser.xhtml"
				action="#{userHome.clearInstance()}"
				rendered="#{identity.hasRole('Instructor')}"/>
			
			<s:button id="back" value="#{messages.Back}"
				view="/Settings/SettingsHome.xhtml" />

		</div>

	</ui:define>

</ui:composition>